'use server'

import { fetcher } from '@/src/utils/fetcher'
import { objectToQueryString } from '@/src/utils/object-to-query-string'
import { cookies } from 'next/headers'

export async function submit(formData: Object) {
  const cookieStore = cookies()
  const res = await fetcher<SubmitResponse>(
    `/api/index/addLiuyan?${objectToQueryString(formData)}`,
    { cookieStore }
  )

  if (res.createtime) {
    return true
  } else {
    return false
  }
}
